<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateMybankTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('mybank_entry', function (Blueprint $table) {
            $table->id();
            $table->string('outOrderNo', 64)->default('')->comment("外部(夸父)订单号");
            $table->string('orderNo', 64)->default('')->comment("网商订单号");
            $table->string('outMerchantId', 32)->default('')->comment("外部(夸父)商户号（申请用）");
            $table->unsignedTinyInteger('type')->default(1)->comment("商户类型 1商家 2夸父");
            $table->string('merchantId', 32)->default('')->comment("网商的商户号");
            $table->string('merchantType', 10)->default('')->comment("01：自然人02: 个体工商户03: 企业商户");
            $table->string('merchantName', 50)->default('')->comment("商户名");
            $table->char('contactMobile', 15)->default('')->comment("联系人手机号。为商户常用联系人联系手机号。");
            $table->char('contactName', 15)->default('')->comment("联系人姓名。为商户常用联系人姓名。");
            $table->char('principalMobile', 15)->default('')
                  ->comment("负责人手机号。开户发送的短信验证码的手机号需要和负责人手机号一致。自然人和个体户必传，企业非必传");
            $table->char('principalCertType', 15)->default('')->comment("负责人证件类型。01：身份证");
            $table->string('principalCertNo', 50)->default('')
                  ->comment("负责人证件号码。备注：若自然人送自然人证件号码、若个体工商户送经营者证件号码、若企业送法人代表证件号码。");
            $table->string('principalPerson', 50)->default('')
                  ->comment("负责人名称或企业法人代表姓名。备注：若商户类型为“自然人”填写责任人本人，若为“个体工商户”填写经营者本人，若为“企业”填写企业法人代表名称");
            $table->string('bussAuthType', 50)->default('')->comment("证件类型");
            $table->string('bussAuthNo', 50)->default('')->comment("证件号");
            $table->string('bussAuthVld', 50)->default('')->comment("有效期");
            $table->unsignedTinyInteger('status')->default(1)->comment("入驻状态 0 待申请 1 申请中 2 激活中 3 已激活");
            $table->unsignedTinyInteger('withholdStatus')->default(1)
                  ->comment("协议代扣状态 1 未开通 2 已申请，未生效 3 已生效 4 解约中待平台确认");
            $table->unsignedInteger('withholdOpenAt')->default(0)->comment('协议代扣开通时间');
            $table->unsignedInteger('withholdCloseAt')->default(0)->comment('协议代扣关闭时间');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('更新人');
            $table->tinyInteger("isDeleted")->default(0)->comment("是否删除,0:未删除,1:已删除");

            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '网商门店入驻信息';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('mybank_entry');
    }
}
